﻿// JScript 文件
//修改日期：2007.07.07 
var m_vRadius = "10";
var preCheck = "";
var EntityType = "";
var currentPageRes = 1;
var pageno  = 1;
var currentPageDet = 1;
var currentPageDetLb = 1;//公共设施信息
var m_pageSize = 10;
var dataNodes = null;
var firPage  = "首  页";
var prePage  = "上一页";
var nextPage = "下一页";
var lastPage = "尾  页";
var m_vFgfw = "";
var tatolPage = "";
var taFxhPage = "";
var m_ResCodenodeVal="";
var m_TypeId =  "";
var SelValue = null;
var m_glidtmp = null;
var vFirCityName = "";
var Detailresult ="";
var Qutype = null;
var ResultFxhDiv = "";
var m_QureyType  = 1;
var ResPonse = "";
var  m_deitalJzmc ="";
var vaddNet="";
var m_vAddNetFirst = 1;
var m_jxBm = "";
var prePageCount = null
var vStartPage = 1;
var vEndPage = 7;
var isKPage = false
var m_softVersion="";
//var m_ViewVersion = 1;
var m_fxhNodesGgSs = null;
var vFgFwXY = "";
var m_vGgSsXY = 0;
var vAllItemGgSs=1;
var iNowPageCountGgSs =1;
var vGgssChe = 0;
var m_Qutype = 0;//配线系统第一次登录为1
var m_vFxhLb = "";
var m_LanNum = "5";
var m_cityType  = 14;
function CheAddNet()
{
     if(ZyqrFrame.chkAddNet.checked==true)
     {
      vaddNet=1;
     }
     else
     {
      vaddNet = 0;
     }
}
function init()
{
    InitDefault();
    GetCity(14,0);
}
function InitDefault()
{
    ZyqrFrame.txtNextAddr.value==""
    ZyqrFrame.chkAddNet.disabled=true;
    ZyqrFrame.ChFj.checked = true;
    ZyqrFrame.ChFj.disabled=false;
    ZyqrFrame.txtJxBm.disabled = false;
    ZyqrFrame.ChYw.disabled=false;
    ZyqrFrame.Addr1.disabled = false;
    ZyqrFrame.Addr2.disabled = false;
    ZyqrFrame.Addr2.disabled = false;
    ZyqrFrame.txtNextAddr.disabled=false;
    ZyqrFrame.btQurey.disabled=false;
    ZyqrFrame.ReSet.disabled=false;
    ZyqrFrame.YhHm.disabled = true;
    
}
function GetElement(divId)
{
    var vDivCreat =   document.getElementById(divId);
    return vDivCreat;
}
function ignoreSpaces(string) //删除中间空格
{
     var temp = ""; 
     string = '' + string; 
     splitstring = string.split(" ");
     for(i = 0; i < splitstring.length; i++) 
     temp += splitstring[i]; 
     return temp; 
 } 
function viryfyNum(times)
{ 
   var lengthNum = ZyqrFrame.YhHm.value.length;
   if(times==1)
   {
       if(lengthNum>="5")
       {
           var Yhhm = parseInt(ZyqrFrame.YhHm.value);
           return true;
       }
       else
       {
           alert('请输入正确电话号码...') 
           ZyqrFrame.YhHm.focus() 
           return false;
       }   
   }
   return true;
}
function getXmlDoc()
{

}
function dzQuery(pageno,times)
{
    //pageno 页码
    //times查询的轮次 1 代表第一次查询，0代表非第一次查询
    ResultFxhDiv.innerHTML ="0";
    var vExp = "";
    m_Qutype = 0;
    var vLanCheck = CheckLan();
    if(pageno==1 && times==1)
    {
        m_vFxhLb = "";
        vGgssChe="0";
        prePageCount = null
        vStartPage = 1;
        vEndPage = 7;
        m_QureyType = 1;
        currentPageRes = 1;
        document.getElementById("UserInfo").style.display="none";
        document.getElementById("JxXX").style.display="none";
        document.getElementById("NowMassage").style.display="none";
    }
    if (ZyqrFrame.ChFj.checked)//地址查询
    {   
          Qutype = 2;//
          var vHeadText = "";
          document.getElementById("NowMassage").style.display="none";
          var elem = document.getElementById("lFgfw");
          if(pageno==1&& times==1 )
          {    //times=1 表示是第一次查询
               ZyqrFrame.btQurey.disabled=true;
               document.getElementById("Result").innerHTML="";
              document.getElementById("NlResult").innerHTML="";
               currentPageRes = 1;
          }
          else 
          {
               ZyqrFrame.btQurey.disabled=false;
          }
          var strAddr1Text = ZyqrFrame.Addr1.options[ZyqrFrame.Addr1.selectedIndex].text;
          var strAddr2Text =ZyqrFrame.Addr2.options[ZyqrFrame.Addr2.selectedIndex].text;
          var secondValue =ZyqrFrame.Addr2.value;
          var vJxbm = ZyqrFrame.txtJxBm.value;
          if(secondValue==null || secondValue=="")
          {
              secondValue = ZyqrFrame.Addr1.value
          }
          var thirdthValue =ZyqrFrame.txtNextAddr.value;
           if(thirdthValue==""&& times==1 && vJxbm =="")
           {
               alert("您还没有输入查找内容，请重新填写...");
               ZyqrFrame.btQurey.disabled=false;
               return;
            }
            if(thirdthValue.length < window.InputNum && vJxbm.length<1)
            {
                  if(vJxbm.length<1 && thirdthValue.length<1)
                  {
                      alert("局向编码的个数不能小于 1 ");
                  }
                  else 
                  {
                      alert("输入的字数的个数不能少于"+window.InputNum+"\n"+"请重新填写...");
                  }
                  ZyqrFrame.btQurey.disabled=false;
                  return;
            }
            else
            {
                 var vJpOrZw = thirdthValue.isCharType();
                 if(vJpOrZw=="ZW")
                 {
                    vAddrBm = thirdthValue;
                    vAddrJp = "";
                    vExp+=" CYDZ like '%"+vAddrBm+"%' ";
                 }
                 else
                 {
                    vAddrJp = thirdthValue;
                    vAddrBm = "";
                    vExp+=" CYJP like '%"+vAddrJp.toUpperCase()+"%' ";
                 }
                 if(vJxbm.length > 0)
                 {
                    if(vExp.length > 0 )
                    {
                        vExp+=" and"
                    }
                    vExp += " JXBM  like '"+vJxbm+"'";
                 }
                 if(strAddr2Text !="请选择--")
                 {
                    vHeadText += strAddr1Text;
                    vHeadText +=strAddr2Text;
                 }
                 else
                 {
                    vHeadText = strAddr1Text;
                 }
                 var params = "_method=dzQury&exp="+encodeURI(vExp)+"&QueryType=Addr"+"&secondValue="+secondValue+"&page="+currentPageRes+"&times="+times+"&vLanCheck="+vLanCheck+"&vHeadText="+vHeadText;
                 CtnTrans.Ajax("/main.ashx", "post", params,ShowfgfwXml,{tel:null},{loading:true,loadingText:"系统查询中，请稍候..."}); 
                 setCookie("strAddr1",strAddr1Text);
                 setCookie("strAddr2",strAddr2Text);
            }
     }
    else if (ZyqrFrame.ChYw.checked)
    {       
            m_vAddNetFirst = 1;
            var elem = document.getElementById("lFgfw");
            Qutype = 3;
            if( viryfyNum(times)) 
            {   
              if( ZyqrFrame.chkAddNet.checked)
              {
                vaddNet = "1";
              }
              if(pageno==1 && times==1 )
               {
                  document.getElementById("Result").innerHTML="";
                  document.getElementById("NlResult").innerHTML="";
                  ZyqrFrame.btQurey.disabled=true;
                  currentPageRes = 1;
               }
               else 
               {
                  ZyqrFrame.btQurey.disabled=false;
               }

               var vYhHm = ZyqrFrame.YhHm.value
               vYhHm = ignoreSpaces(vYhHm);
               if(vYhHm == null || vYhHm == "")
               {
                    top.CtnDlg.msg("电好号码不能为空!");
                    ZyqrFrame.btQurey.disabled=false;
                    return;
               }
               var params = "_method=dzQury&exp="+vYhHm+"&QueryType=Tel&page="+currentPageRes+"&addNet="+vaddNet+"&times="+times+"&vLanCheck="+vLanCheck;
               CtnTrans.Ajax("/main.ashx", "post", params,ShowfgfwXml,{tel:vYhHm},{loading:true,loadingText:"系统查询中，请稍候..."}); 
               //var loaderXml = new net.ContentLoader("query.ashx?", ShowfgfwXml, null, );    
            }
            else
            {
             return;
            }
    }
}
function GetCity(typeid, glid)
{
    var  params = "_method=GetCity&typeid="+typeid+"&glid="+glid;
    CtnTrans.Ajax("/main.ashx", "post", params,showCity,null,{loading:true,loadingText:"系统查询中，请稍候..."});
    m_TypeId = typeid;
    m_glidtmp = glid;
}
    
function showCity(res)
{
      var ResText = res.responseText;
      var XmlVal = CtnXML.getXmlDoc();
      if (!CtnError.validate(ResText))
      {
          CtnError.show();
          return;
      }
      else
      {
           XmlVal.loadXML(ResText);
      }
      var root =  XmlVal.selectNodes('Items');
      var nodes = XmlVal.selectNodes('Items/Item');
      var Addr2Option = document.createElement("OPTION"); //第二级地址
      if(nodes.length==0)
       {
          return; 
       }
       else
       {  
             var strSel = null;   
             switch(m_TypeId)
             {
                case m_cityType : 
                { 
                   strSel = ZyqrFrame.Addr1;
                   ZyqrFrame.Addr1.innerHTML = "";
                   Addr2Option.value = "";
                   Addr2Option.text  = "请选择--"; 
                   ZyqrFrame.Addr1.add(Addr2Option);
                   if(nodes.length == 0)
                   {
                      return;
                   }
                   ZyqrFrame.Addr2.innerHTML = "";
                }
                break;
                case (parseInt(m_cityType)+1) :
                {
                    strSel = ZyqrFrame.Addr2;
                    ZyqrFrame.Addr2.innerHTML = "";
                    Addr2Option.value = "";
                    Addr2Option.text  = "请选择--"; 
                    ZyqrFrame.Addr2.add(Addr2Option);
                    if(nodes.length == 0)
                    {
                       return;
                    } 
                }
                break;
                default:
                break;
             }
             
           for(var i = 0; i < nodes.length; i++)
           {
              var ResName= nodes[i].selectNodes("bm");
              var ResID0 = nodes[i].selectNodes("id0");
              var ResTypenode = nodes[i].selectNodes("type");
              var FirstOption = document.createElement("OPTION");
              FirstOption.text=ResName[0].text;
              FirstOption.value=ResID0[0].text;
              strSel.add(FirstOption);
           }
           if(m_TypeId==m_cityType)    
           {
                setFirstCity(1);
           }
           if(m_TypeId==2)
           {
                if(getCookie("strAddr2")!=null)
                {   var strAddr2 = getCookie("strAddr2");
                    for(var i=0;i<strSel.options.length;i++)
                   {
                     if(strSel.options[i].text==strAddr2)
                     {
                        strSel.selectedIndex = i;
                        break;
                     }
                   }
                }
           }
          
       }
}
function CityNameIsHasQx(ResName)
{
 }
function setFirstCity(typeid)
{
   var  CountJ = "-1";
   var objSelect = null;
   objSelect = ZyqrFrame.Addr1;
   objSelect.selectedIndex = 0;
   SelValue = objSelect.value;
   if(getCookie("strAddr1")!=null)
   {   
        var strAddr1 = getCookie("strAddr1");
        for(var i=0;i<objSelect.options.length;i++)
        {
             if(objSelect.options[i].text==strAddr1)
             {
                  objSelect.selectedIndex = i;
                  SelValue = objSelect.options[i].value;
                  break;
             }
       
       }
   }
    GetCity(parseInt(m_cityType)+1,SelValue);
}
//营业区
function setYyq()
{
   var  CountJ = "-1";
   var objSelect = null;
   objSelect = ZyqrFrame.Yyq;
   objSelect.selectedIndex = 0;
   SelValue = objSelect.value;
   if(getCookie("YYQ")!=null)
   {
        var vYyq = getCookie("YYQ");
        for(var i=0;i<objSelect.options.length;i++)
        {
             if(objSelect.options[i].value==vYyq)
             {
                  objSelect.selectedIndex = i;
                  SelValue = objSelect.options[i].value;
                  break;
             }
       }
   }
}
function ShowfgfwXml(res,telNum)
{
     var  vAllItem = 0;
     var  vaddNet     = "";
     var  vLstRes     = "";
     var  vLstResCode = "";
     var  strAnzWz    = "";
     var  vJxbm       = "";
     var  iEndPage     = 0;//是否是最后一页:1是；0不是。
     var  iNowPageCount = 0;
     var  strAnzWz      = "";
     var  dtMassage     = "";
     var ResText = res.responseText;
     if (!CtnError.validate(ResText))
     {
         CtnError.show();
         return;
     }
     else
     {
          var XmlVal = CtnXML.getXmlDoc();
           XmlVal.loadXML(ResText);
     }
     var ifHanQx = 0;
     var  vLanCode = "";
      if(Qutype=="3")
      {
            ResPonse = ResText.split("#|$");
           if(ResPonse.length==2)
           {
              alert(ResPonse[1]);
              if(ResPonse[1]=="页面已过期，请重新登录")
              {
                 LoadingAgain();
              }
              ZyqrFrame.btQurey.disabled=false;
              return;
           }
           else
           { 
              ResPonse = ResText.split("#@$");
              XmlVal.loadXML(ResPonse[0]);
              iEndPage = ResPonse[1];
              vAllItem = ResPonse[2];
              iNowPageCount = ResPonse[3];
           }
      }
      else
      {   
           ResPonse = ResText.split("#|$");
           if(ResPonse.length==2)
           {
              alert(ResPonse[1]);
              if(ResPonse[1]=="页面已过期，请重新登录")
              {
                 LoadingAgain();
               }
               ZyqrFrame.btQurey.disabled=false;
               return;
           }
           else
           {
              ResPonse = ResText.split("#@$");
              XmlVal.loadXML(ResPonse[0]);
              iEndPage = ResPonse[1];
              vAllItem = ResPonse[2];
              iNowPageCount = ResPonse[3];
              strAnzWz = ResPonse[10];
           }
      }
       var root =  XmlVal.selectNodes('Items');
       var nodes = XmlVal.selectNodes('Items/Item');
       dataNodes = nodes;
       //dataNodes = SortdataNodes(nodes,"fgfw");
       if(nodes.length == 0)//覆盖范围的信息为空，对于电话查询，要显示能力分析
       {
             if(Qutype=="3" )
             {
                   if(iEndPage=="0")
                   {
                       if(CheckLan()=="0")
                       {
                            if(vLstRes=="0" && vLstResCode=="0")
                            {
                                 alert("没有找到与该号码相关的信息...");
                                 ZyqrFrame.btQurey.disabled=false;
                                 return;
                            }
                            if(ifHanQx =="0")
                            {
                                 alert("您没有权限读取该电话号码的信息...");
                                  ZyqrFrame.btQurey.disabled=false;
                                 return;
                            }
                       }
                       else if(CheckLan()=="1")//在tsfgfw中没有局向信息，没有办法去判断是否有LAN资源
                       {
                           
                            alert("没有找到与此号码相关得LAN资源。请根据地址查询...");
                       }
                   }
                   else
                   {
                      alert("已经是最后一页");
                      if(currentPageRes!="1")
                      {
                        currentPageRes=parseInt(currentPageRes)-1;
                      }
                   }
                   ZyqrFrame.btQurey.disabled=false;
                   return;
            }
            if(nodes.length == 0 && (iEndPage=="0" && iNowPageCount=="0") && isKPage==false)//2007-12-27修改
            {
                alert("地址匹配失败地址库不规范，请根据号码查询，若没有可能需要外勘或新建...");
            }
            else
            {
                alert("已经是最后一页");
                if(currentPageRes!="1")
                {
                    currentPageRes=parseInt(currentPageRes)-1;
                }
           }
         ZyqrFrame.btQurey.disabled=false;
         return;
       }
     showDtailFgFw(vAllItem,iNowPageCount,strAnzWz,telNum.tel); 
     ZyqrFrame.btQurey.disabled=false;
}

function showDtailFgFw(vAllItem,iNowPageCount,strAnzWz,telnum)
{
//      top.LocateType="28";//非公共设施定位
      var ResultDiv = document.getElementById("Result");

      var str = "<table cellSpacing='0' cellPadding='0' width='93%'  align='center' border='1' bordercolor=gray  style='background-color:#d9e7f8;' id = 'resultTable'>";
      str += "<tr height=20px style='COLOR: black; FONT-FAMILY: 宋体'><td align=center height=20px width=30px>序号</td><td align=center width=150px>覆盖范围</td></tr>";
      for(var i = 0; i < dataNodes.length; i++)
      {
          var xmlId0 = dataNodes[i].selectNodes("AddrID0");
          var Fgfwnode = dataNodes[i].selectNodes("fgfw");
          var ResTypenode = dataNodes[i].selectNodes("NetResType");
          var ResCodenode = dataNodes[i].selectNodes("NetResCode");
          var xmlJxbm = dataNodes[i].selectNodes("jxbm");
          var JzMc   = dataNodes[i].selectNodes("jzMc");
          var xLan =  dataNodes[i].selectNodes("LAN");
          var xmlLanJxBm = dataNodes[i].selectNodes("LanJxBm")
          var xmlLanJxMc = dataNodes[i].selectNodes("LanJxMc");
          var xmlLstRes = dataNodes[i].selectNodes("LstRes");
          var xmlLstResCode = dataNodes[i].selectNodes("LstResCode");
          tatolPage="";
          var vType  = ResTypenode[0].text;
          var lan = xLan[0].text;
          var tmpFgfw = ignoreSpaces(Fgfwnode[0].text);
          m_vFgfw = tmpFgfw;
          var ResCodenodeVal   = ResCodenode[0].text;
          var Id0Val  = xmlId0[0].text;
          var vJxbm = xmlJxbm[0].text.split(',')[0];
               //var arrData = vid.split("#|$");
          var reSultjzmc = JzMc[0].text;
          var vLstRes = xmlLstRes[0].text;
          var vLstResCode = xmlLstResCode[0].text;
          var strLAN =""
          var strlansb = "";
         // if(lan=="5")
         if(lan==m_LanNum)
            {
                 strLAN="(存在LAN设备)";
                 strlansb = "(存在LAN设备)";
                
            }
          var vLanJxBm = xmlLanJxBm[0].text;
          var vLanJxMc = xmlLanJxMc[0].text;
          var vid = vType + "#|$" + ResCodenodeVal + "#|$" + Id0Val + "#|$" +m_vFgfw+"#|$"+xmlJxbm[0].text+"#|$"+reSultjzmc + "#|$" + vLstRes + "#|$" + vLstResCode+"#|$"+strLAN;
          var Did = vType + "#|$" + ResCodenodeVal;
          var lanId =  vLanJxBm + "#|$" + vLstResCode + "#|$" + tmpFgfw;
          var vOnclick = "";
          if(Qutype=="3" &&  CheckLan()=="1" && i=="0" )
          {
              ShowLanByTel(vLanJxBm,vLstResCode,tmpFgfw);
          }
          if(lan==m_LanNum)
          {
              vOnclick = "ShowLan"
          }
          var j = (currentPageRes-1)*m_pageSize+i + 1;
          //if(lan=="5")
          if(lan==m_LanNum)
          {
              str += "<tr height='100%' ><td align=center>"+j+"</td><td align=left colspan='3' style='Color:6699cc'><span  onclick='ShowFxhMas(this)' id="+lanId+" title='LAN局向编码："+vLanJxBm+"\nLAN局向名称："+vLanJxMc+"'><a href='javascript:void(0);'>"+m_vFgfw+"</a></span><font color=red>"+strLAN+"</font></td></tr>";
          }
          else
          {
             str += "<tr height='100%' ><td align=center>"+j+"</td><td align=left colspan='3' style='Color:6699cc'><span  onclick='ShowFxhMas(this)' id="+vid+"  title='局向编码："+vJxbm+"\n局向名称："+reSultjzmc+"'><a href='javascript:void(0);'>"+m_vFgfw+"</a></span><font color=red>"+strLAN+"</font></td></tr>";
          }
      }
      str += "</table>";
      var strTatol = "<table width='93%'  align='center' border='1' cellSpacing='0' cellPadding='0' bordercolor=gray>";
      strTatol += "<tr id="+(Did+1)+" height=20><td align=center width='30%'>当前第"+currentPageRes+"页</td><td align=center width='70%'>约有"+vAllItem+"条符合查询条件</td></tr></table>";
      var strPage= "<table width='93%'  align='center' border='0' bordercolor=gray>";
      strPage += "<tr id="+Did+" height=20><td align=center width='25%'><a href='javascript:goPre(1);'>"+prePage+"</a></td>"

     if(parseInt(iNowPageCount)<7)
     {
       vStartPage = 1;
       vEndPage = parseInt(iNowPageCount)+1;  
     }
     if((currentPageRes)%6==0 && currentPageRes>5 && isKPage)
     {
        vStartPage=currentPageRes-5;
        if(parseInt(iNowPageCount)>parseInt(vStartPage)+6)
        {
            vEndPage=parseInt(vStartPage)+6;
        }
        else
        {
            vEndPage=parseInt(iNowPageCount);
        }
        
     }
     if(((currentPageRes-1)%6==0 && currentPageRes>1) || ((currentPageRes == parseInt(prePageCount)||currentPageRes == parseInt(prePageCount)+1)&&prePageCount!=null) )//下一页会翻的那页
     {
         vStartPage=currentPageRes;
       if((currentPageRes == parseInt(prePageCount)||currentPageRes == parseInt(prePageCount)+1)&&prePageCount!=null)
       {
          vStartPage=parseInt(currentPageRes)-(parseInt(currentPageRes)%6)+1;
          if(parseInt(currentPageRes)%6==0)
          {
             vStartPage=currentPageRes-5;
          }
       }
      if(parseInt(iNowPageCount)>=parseInt(vStartPage)+6)
        {
            vEndPage=parseInt(vStartPage)+6;
        }
        else
        {
            vEndPage=parseInt(iNowPageCount) + 1;
        }
     }
     if(vEndPage==1)
     {
       strPage +="<td align=center  width='5%'><a href='javascript:GotoPage("+vEndPage+");'><font color=red>"+vEndPage+"</font>&nbsp</a></td>";
     }
     else
     {
         for( var j= vStartPage;j<vEndPage;j++)
         {
              if(currentPageRes==j)
              { 
                strPage +="<td align=center  width='5%' ><a href='javascript:GotoPage("+j+");'><font color=red>"+j+"</font>&nbsp</a>";
              }
              else
              {
                strPage +="<td align=center  width='5%'><a href='javascript:GotoPage("+j+");'>"+j+"&nbsp</a>";
              }
              strPage +="</td>";
         }
     }
     strPage += "<td align=center  width='25%'>";
     if( parseInt(vAllItem) > parseInt(m_pageSize))
     {
         strPage +=  "<a href='javascript:goNext(1);'>"+nextPage+"</a>";
     }
     else
     {
             strPage +=nextPage
     }
     strPage +=  " </td></tr></table>";
     prePageCount = iNowPageCount;
     isKPage = false
     var  strAll= (str+=strPage+=strTatol);
     ResultDiv.innerHTML = strAll;
     ZyqrFrame.btQurey.disabled=false;
     ResultDiv.style.display="block";
     if(Qutype=="3")
     {
        GetTelJx(telnum);
     }
}
function goPre(TableId)
{   
    if(TableId==1)
    {
        isKPage = true
        if(currentPageRes<=1)
        { 
            alert("当前已经是第一页！");
            return;
        }
        else
        {
           currentPageRes = currentPageRes - 1;
         }
         dzQuery(currentPageRes,0);
     }
    else  if(TableId==2)
    {
        if(currentPageDet<=1)
        { 
           alert("当前已经是第一页！");
           return;
         }
        else
         {
           currentPageDet = currentPageDet - 1;
         }
        goFxhPage()
    }
 else  if(TableId==3)
 {
       isKPage = true
      if(currentPageDetLb<=1)
        { 
           alert("当前已经是第一页！");
           return;
         }
        else
         {
           currentPageDetLb = currentPageDetLb - 1;
         }
       dzQuery(currentPageDetLb, 0);
 }
}
function goNext(TableId)
{ 
   if(TableId==1)
   {
     isKPage = true
     if(currentPageRes == tatolPage)
      {
        alert("当前已经是最后一页了！");
        if(currentPageRes!="1")
        {
          currentPageRes=parseInt(currentPageRes)-1;
        }
        return ;
      }
      else
      {
        currentPageRes = parseInt(currentPageRes) + 1;
        dzQuery(currentPageRes, 0);
      }
   }
  else if(TableId==2)
  {
     if(currentPageDet==taFxhPage)
      {
          alert("当前已经是最后一页了！");
           if(currentPageRes!="1")
        {
          currentPageRes=parseInt(currentPageRes)-1;
        }
          return ;
      }
      else
      {
          currentPageDet = parseInt(currentPageDet) + 1;
          goFxhPage()
      }
   }
 else  if(TableId==3)
 {
      if(currentPageDetLb==taFxhPage)
        { 
           alert("当前已经是最后一页了！");
           return;
         }
        else
         {
           currentPageDetLb =parseInt(currentPageDetLb)+1;
         }
      dzQuery(currentPageDetLb, 0);
 }
 }
function goFirst(TableId)
   {
     if(TableId==1)
      {
          if(currentPageRes == 1)
          {
            alert("当前已经是第一页！");
            return ;
           }  
          currentPageRes = 1;
          dzQuery(currentPageRes,0);
      }
     else if(TableId==2)
      {
         if(currentPageDet == 1)
          {
            alert("当前已经是第一页！");
            return ;
          }  
         currentPageDet = 1;
         goFxhPage()
      }
 else  if(TableId==3)
 {
      if(currentPageDetLb==1)
        { 
           alert("当前已经是第一页！");
           return;
         }
        else
         {
           currentPageDetLb =1;
         }
       dzQuery(currentPageDetLb, 0);
 }
}
function goLast(TableId)
{
    if(TableId==1)
     {
       if(currentPageRes == tatolPage)
        {
          alert("当前已经是最后一页了！");
           if(currentPageRes!="1")
        {
          currentPageRes=parseInt(currentPageRes)-1;
        }
          return ; 
        }
       currentPageRes = tatolPage;
       dzQuery(currentPageRes, 0);
    }
    else if(TableId==2)
    {
       if(currentPageDet == taFxhPage)
        {
          alert("当前已经是最后一页了！");
           if(currentPageRes!="1")
            {
              currentPageRes=parseInt(currentPageRes)-1;
            }
          return ; 
        }
        currentPageDet = taFxhPage;
        goFxhPage()
    }
 else  if(TableId==3)
 {
      if(currentPageDetLb==taFxhPage)
        { 
            alert("当前已经是最后一页了！");
            if(currentPageDetLb!="1")
            {
              currentPageDetLb=parseInt(currentPageDetLb)-1;
            }
            return ; 
         }
        currentPageDetLb =taFxhPage;
      dzQuery(currentPageDetLb, 0);
 }
} 

function GotoPage(iPage)
{
  if(iPage==1&&currentPageRes==1)
  {
    return;
  }
  currentPageRes = iPage;
  dzQuery(iPage, 0);
}
//电话直接进行的能力分析
function DirShowFxh(resType,resCode,vFgfw,vJzmc,vaddNet,vJxbm, vRes, vResCode,strAnzWz,strLAN)
{
     SecendEntLocate(resType,resCode,vFgfw,vJzmc,vaddNet,vJxbm, vRes, vResCode,strAnzWz,strLAN);
} 

//能力分析
function ShowFxhMas(ID)
{
//     m_vAddNetFirst = 0;
     var ResultFxhDiv=document.getElementById("NlResult");
     ResultFxhDiv.innerHTML ="";
     var dtMassage="";
     var strAnzWz = "";
     var vid = ID.id; 
     var arrData = vid.split("#|$");
     var resType = arrData[0];
     var resCode = arrData[1];
     m_ResCodenodeVal = resCode;
     var vFgfw  = arrData[3].replace(" ","");
     var vJxBm = arrData[4];
     m_jxBm = vJxBm;
     var vJzMc = arrData[5];
     var vLstRes = arrData[6];
     var vLstResCode = arrData[7];
     var strLAN = arrData[8];
     SecendEntLocate(resType,resCode,vFgfw,vJzMc,vaddNet,vJxBm, vLstRes, vLstResCode,strAnzWz,strLAN)
}
function GetDetailResCode(ID)
{
    var vid = ID.id; 
    var arrData = vid.split("#|$");
    var resType = arrData[0];
    var resCode = arrData[1];
    var Fxhbm = arrData[2];
    //var vXdZs = arrData[3];//当都是0的时候，去找配线
     var vLstBz = arrData[3];//宽带和语音的备注集合
     var VKdKx = arrData[5];
     var VDhKx  =arrData[4];
     var VazWz = arrData[6];
     var VvFgfwBm = arrData[7];
     top.KdKx=VKdKx;     
     top.YyKx = VDhKx;
     top.vFgfwBm=VvFgfwBm;
     top.Fxhbm = Fxhbm;
     top.azWz=VazWz;
     var vDhBz = vLstBz.split("|")[0];
     var vKdBz = vLstBz.split("|")[1];
     if (resType != null && resCode != null)
     {
        if(VDhKx=="0" ||VDhKx=="")
        {
            if(vDhBz=="")
            {
                vDhBz = "无配线";
            }
            var vAlertChar = "语音线路:"+vDhBz+"\n";
            if(VKdKx =="0" || VKdKx =="")
            {
                if(vKdBz=="")
                {
                    vKdBz="无配线"
                }
                vAlertChar+="宽带线路:"+vKdBz;
            }
            top.CtnDlg.msg(vAlertChar);
            //alert(vAlertChar);
        }
       else if(VKdKx=="0" || VKdKx=="")
       {
            var vAlertChar ="宽带线路:"+vKdBz;
            if(vKdBz=="")
            {
                vKdBz="无配线"
            }
            top.CtnDlg.msg(vAlertChar);
            //alert(vAlertChar);
       }
        if (resType != 0)
        { 
           // EntLocate(vEntType ,resCode);
           GetEntLocate(resType ,resCode);
        }
     }
}

  
function ShowDeteilMassage(res,params)
{
//要换成有LAN信息的接口
    var ResText = res.responseText;
    if (!CtnError.validate(ResText))
    {
        CtnError.show();
         ZyqrFrame.btQurey.disabled=false;
        return;
    }
    else
    {
         var XmlVal = CtnXML.getXmlDoc();
         XmlVal.loadXML(ResText);
    }
    var VResPonse = ResText.split("#@$");
    var XmlText = VResPonse[0];
    XmlVal.loadXML(XmlText);
    Detailresult = XmlText;
    m_vFgfw = params.fgfw;
    m_deitalJzmc =  params.vJzMc;
    vaddNet = params.vaddNet;
    var strJxbm = params.vJxbm;
    m_jxBm = strJxbm;
    var root = XmlVal.selectNodes('Items');
    var nodes = XmlVal.selectNodes('Items/Item');
    if(nodes.length==0)
    { 
        if(Qutype=="3")
        {
             alert("没有找到相关的电话号码信息，请重新核对...");
               ZyqrFrame.btQurey.disabled=false;
             return;
        }
        alert("该地址资源无法确认...");
        ZyqrFrame.btQurey.disabled=false;
    }
    else
    {
       fxhNodes = nodes;
       currentPageDet = 1;
       goFxhPage();
    }
}
function goFxhPage()
{
      var pageSize =m_pageSize;
      var start = pageSize * (currentPageDet - 1);
      var end = pageSize * currentPageDet;
      var tempTatol = parseInt(fxhNodes.length/pageSize);
      var azWz = "";
      var vFxhBm = "";
      var vFgf = "";
      var avgSpeed="";
      var LlSl ="";
      var dXlcd = "";
      var ScDk ="";
      var vResCode = "";
      var vResType = "";
      var vJrdAdsl = "";
      var vJrdVdsl = "";
      var vKdjrdJx = "";//宽带接入点信息      var vRealRate = "";
      var vDhBz = "";
      var vKdBz = "";
      if(tempTatol * pageSize< fxhNodes.length)
      {
         taFxhPage = tempTatol + 1;
      }
      else
      {
        taFxhPage = tempTatol;
      }
      if(end > fxhNodes.length)
      {
         end = fxhNodes.length;
      }
        var DhKx = 0;
        var KdKx = 0;
        var ResultFxhDiv=document.getElementById("NlResult");
        var str="<table cellSpacing='0' cellPadding='0' width='97%' align='center' border='1' bordercolor=gray style='background-color:grey'>";
        str+="<tr height=20px style='COLOR: black; FONT-FAMILY: 宋体'><td align=center height=20px width='8%'>分线盒编码</td><td align=center width='8%'>所属局向信息</td>";
       
        str+="<td align=center width='8%'>可提供语音线路资源数量</td>";
        str+="<td align=center width='9%' id='tdYy'>可提供宽带线路资源数量</td>";
        str+="";
        //str+="<td align=center width='7%'>是否可加装</td><td align=center width='8%'>参考平均可达速率</td><td align=center width='8%'>详细信息</td>";
        str+="<td align=center width='8%'>参考平均可达速率</td><td align=center width='8%'>详细信息</td>";
        str+="</tr>";
        for(var i = start; i < end; i++)
        {
             var xmlJrdAdsl = fxhNodes[i].selectNodes("ZJJRDADSL");
             var xmlJrdVdsl = fxhNodes[i].selectNodes("ZJJRDVDSL");
             var xmlSport     = fxhNodes[i].selectNodes("SPORTCOUNT");
             var xmlLanCount  = fxhNodes[i].selectNodes("LANCOUNT");
             var xmlAport     = fxhNodes[i].selectNodes("APORTCOUNT");
             var xmlVport     = fxhNodes[i].selectNodes("VPORTCOUNT");
             var xmlJrsbmc = fxhNodes[i].selectNodes("JRSBMC");
             var wz       = fxhNodes[i].selectNodes("wz");
             var bm       = fxhNodes[i].selectNodes("bm");
             var DhXKo    = fxhNodes[i].selectNodes("DhNumKo");
             var KdXKo    = fxhNodes[i].selectNodes("KdNumko");
             var xmlDhBz   = fxhNodes[i].selectNodes("DhBZ");//电话备注
             var xmlKdBz   = fxhNodes[i].selectNodes("KdBZ");//宽带备注
             var resTypes = fxhNodes[i].selectNodes("resType");
             var resCodes = fxhNodes[i].selectNodes("resCode");
             var xmlDXlcd = fxhNodes[i].selectNodes("dXlCd");
             var xmlJzmc  = fxhNodes[i].selectNodes("Jzmc");
             var xmlJxbm  = fxhNodes[i].selectNodes("Jxbm");//m_jxBm
//             var vIfWide  = fxhNodes[i].selectNodes("ifwide");
             var xmlRealRate = fxhNodes[i].selectNodes("realRate");//实测可达速率
             
             if(m_softVersion=="2")
             {
                  var xLusl = fxhNodes[i].selectNodes("sLusl");
                  var VScSl = fxhNodes[i].selectNodes("davg");
                  ScDk = VScSl[0].text;
                  LlSl = xLusl[0].text;
                  if(ScDk=="0")
                  {
                      ScDk="&nbsp";
                  }
             }
             vRealRate  = xmlRealRate[0].text;
             var vTmpRate = vRealRate.split('-');
             if(vTmpRate.length < 2)
             {
                vRealRate = (parseInt(vRealRate*100))/100;
             }
             vJrdAdsl   = xmlJrdAdsl[0].text;
             vJrdVdsl   = xmlJrdVdsl[0].text; 
             vJzmc      = xmlJzmc[0].text;//自身局站 名称
             vJxBm      = xmlJxbm[0].text;//
             azWz       = wz[0].text;
             vFxhBm     = bm[0].text;
             vResCode   = resCodes[0].text;
             vResType   = resTypes[0].text;
             DhKx       = DhXKo[0].text;
             KdKx       = KdXKo[0].text;
             dXlcd      = xmlDXlcd[0].text;
             var LstBz = xmlDhBz[0].text+"|"+xmlKdBz[0].text;
             
             var vJhjkx = xmlSport[0].text;//"交换机空闲数";
             if(vJhjkx =="" || vJhjkx ==null)
             {
                 vJhjkx = 0;
             }
             var vKzdh  = vJhjkx;//"可装电话数";
             if(parseInt(vJhjkx) >parseInt(DhKx))
             {
                vKzdh = DhKx;
             }
             var vLanCount = xmlLanCount[0].text;

              var vJxAdsl = xmlAport[0].text;//该局向Adsl端口数量
              var vJxVdsl = xmlVport[0].text;//该局向Vdsl端口数量
               if(vJxAdsl !=""  ||  vJxVdsl !="")
               {
                   vJxVdsl +="(局向端口)";
               }
//             }
             var vJxXdsl = vJxAdsl+"/"+vJxVdsl;
             var vAdsl = vJrdAdsl+"/"+vJrdVdsl;//"最近的接入点(或者是分线盒所属局向)的ADSL/VDSL数量";
//            vTmpKd = parseInt(vJrdAdsl) + parseInt(vJrdVdsl);
             if(vJxAdsl=="" || vJxAdsl==null)
             {
                vJxAdsl = "0";
             }
             if(vJxVdsl == null || vJxVdsl == "")
             {
                vJxVdsl ="0";
             }
             vTmpKd = parseInt(vJxAdsl) + parseInt(vJxVdsl);
             vKzKd  =parseInt(vTmpKd) > parseInt(KdKx) ? KdKx : vTmpKd;
             var vJrsbMc = xmlJrsbmc[0].text;
//              var ifAddNet =vIfWide[0].text;
            var ifAddNet ="&nbsp";
             if(i==0)
             {
                 top.KdKx = KdKx;
                 top.Fxhbm = vFxhBm;
                 top.YyKx = DhKx;
                 top.vFgfwBm= m_vFgfw;
                 top.azWz=azWz;
                // top.ifAddNet = ifAddNet;
                 top.JxMasse    = vJzmc+"("+vJxBm+")";
                 top.ADSLCount  = xmlAport[0].text;
                 top.VDSLCount  = xmlVport[0].text;
                 top.JhjCount   = vJhjkx;
                 top.ZjLanCOunt = vLanCount;
                 top.JxNoSameMasse =  fxhNodes[i].selectNodes("ZJJXMC")[0].text+"("+ fxhNodes[i].selectNodes("ZJJXBM")[0].text+")";
                 top.vJrsbMc = vJrsbMc;
                 top.vJrdAdslCount = vJrdAdsl;
                 top.vJrdVdslCount = vJrdVdsl;
             }
              if(vResType=="11")
             {
                vFxhBm+="(综合箱)"
             }
             //top.LocateType ="28";
             vKdjrdJx = fxhNodes[i].selectNodes("ZJJXMC")[0].text+"("+ fxhNodes[i].selectNodes("ZJJXBM")[0].text+")";
             azWz = ChangeChar(azWz);
             m_vFgfw = ChangeChar(m_vFgfw);
             var vid = vResType + "#|$" + vResCode+"#|$"+ vFxhBm+"#|$"+LstBz+"#|$"+DhKx+"#|$"+KdKx+"#|$"+azWz+"#|$"+m_vFgfw;
             var vDataid=vid+"#|$"+dXlcd+"#|$"+vJzmc+"#|$"+vJxBm+"#|$"+vJhjkx+"#|$"+vKzdh+"#|$"+vAdsl+"#|$"+vKzKd+"#|$"+ifAddNet+"#|$"+vLanCount+"#|$"+vJrsbMc+"#|$"+vKdjrdJx+"#|$"+vJxXdsl;
             if(ifAddNet=="否")
             {
                if(dXlcd=="0")
                {
                   dXlcd="&nbsp";
                }
                else
                {
                    dXlcd +="米";
                }
             }
             else if(ifAddNet=="是")
             {
                dXlcd="&nbsp";
             }
             str += "<tr  height=20 ><td align=center><span  onclick='m_doc.getWndElem(m_vt.GQGRGL_ZYQR).GetDetailResCode(this)' id='"+vid+"'><a href='javascript:void(0);'><u>"+ChgUndefined(vFxhBm)+"</u></a></span></td>";
             str+="<td align=center>"+ChgUndefined(vJzmc)+"("+ChgUndefined(vJxBm)+")"+"</td>";
             str+="<td align=center><font color='#003399'>"+ChgUndefined(DhKx)+"&nbsp</font></td>";
             str+="<td align=center><font color='#003399'>"+ChgUndefined(KdKx)+"</td>";
             str+="<td align=center><font color='#003399'>"+ChgUndefined(vRealRate)+"&nbsp M</font></td>";
             str+="<td align=center><span onclick='m_doc.getWndElem(m_vt.GQGRGL_ZYQR).ShowDetailMess(this)' id="+vDataid+"><a href='javascript:void(0);'><u>点击查看</u></a></td>";
             str+="</tr>";
        }
        str += "</table>";
        var strPage= "<table cellSpacing='0' cellPadding='0' width='100%'  align='center' border='0' bordercolor=gray>";
        strPage += "<tr  height=20></td><td align=center width='10%' >当前第"+currentPageDet+"页</a><td align=center width='10%'>每页10条</a><td align=center width='10%' >总共"+taFxhPage+"页</a></td>";
        strPage += "<td align=center width='15%' ><a href='javascript:goFirst(2);'>"+firPage+"</a></td><td align=center width='15%'><a href='javascript:goPre(2);'>"+prePage+"</a></td>";
        strPage += "<td align=center  width='20%'><a href='javascript:goNext(2);'>"+nextPage+"</a></td><td align=center  width='20%'><a href='javascript:goLast(2);'>"+lastPage+"</a></td></tr></table>";
        var  strFxh= (str+=strPage);
       //ResultFxhDiv.innerHTML = strFxh;
        
        var dlg = new CtnDlgCtrl();
         var params = {title:"能力分析",
         content:strFxh,
         bmove:true,
         bmodal:false,
         bmax : false,
         bmin : false,
         left   : 240,   //Left
         bout   : true,
         dlgtop : screen.height - 300,
         width:screen.width-240,height:200,
         arrbtn: [{text:"关闭", onClick:function(){dlg.close();},input:"SeleQuCss"}]
         }
         dlg.init(params);
         dlg.open();
        if( vaddNet=="1")//加装部分－－预留ld
        {
             var strInfo="<table cellSpacing='0' cellPadding='0' width='100%'  align='center' border='1' bordercolor='#C8C8C8'>";
             strInfo += "<tr height='100%' style='FONT-FAMILY: 宋体'>";
             if(ifAddNet == "否")
             {
               strInfo += "<tr height='100%' style=' FONT-FAMILY: 宋体'><td aslign=Left height='100%' colspan='2'>所属分线盒是否可加装宽带</td><td align=center width='60px'><font color='#003399'>否</font></td></tr>";
             }
             else if(ifAddNet == "是")
             {  
                 strInfo += "<tr height='100%' style=' FONT-FAMILY: 宋体'><td align=Left height='100%' colspan='2'>所属分线盒是否可加装宽带</td><td align=center width='60px'><font color='#003399'>是</font></td></tr>";  
             }
            var params = "_method=ShowJxXx&strlJzmc="+m_deitalJzmc+"&addNet="+vaddNet+"&ifAddNet="+ifAddNet+"&jxBm="+m_jxBm;
            CtnTrans.Ajax("/main.ashx", "post", params,ShowJxXx,null,{loading:true,loadingText:"系统查询中，请稍候..."}); 
            strInfo += "</table>";
            ZyqrFrame.btQurey.disabled=false;
            NowMassage.innerHTML =strInfo;
            document.getElementById("NowMassage").style.display="block"; 
        }
        //ResultFxhDiv.style.display="block"; 
        GetEntLocate(fxhNodes[0].selectNodes("resType")[0].text,fxhNodes[0].selectNodes("resCode")[0].text);
  }
function ShowJxXx()
{
     document.getElementById("JxXX").style.display="block";
     var vError = this.req.responseText.split("#|$");
     if(vError.length==2)
     {
       alert(vError[1]);
        if(vError[1]=="页面已过期，请重新登录")
       {
          LoadingAgain();
       }
        ZyqrFrame.btQurey.disabled=false;
       return;
     }
     var vJxPonse   = this.req.responseText.split("#@$");
     var vSameDk    = vJxPonse[0];
     var vSameMc    = vJxPonse[1];
     var vSameDz    = vJxPonse[2];
     var vNsameDk   = vJxPonse[3];
     var vNsameMc   = vJxPonse[4];
     var vNsameDz   = vJxPonse[5];
     var vNsameJxBm = vJxPonse[6];
     //var vIfWide    =  vJxPonse[7];
     if(vSameMc=="")
     {
       vSameMc ="&nbsp";
       vSameDz ="&nbsp";
     }
     if(vNsameJxBm=="")
     {
       vNsameJxBm = "&nbsp";
     }
     var strXlMass  = "";
      strXlMass="<table cellSpacing='0' cellPadding='0' width='100%'  align='center' border='1' bordercolor='#C8C8C8'>";
//     if(vIfWide=="是")
//     {
         if (vSameMc!= vNsameMc && vNsameMc!="")
         {
              strXlMass += "<tr style='tr'><td class='td' colspan='3'>同局向宽带线路能力</td></tr>";
              strXlMass += "<tr style='tr'><td class='td' colspan='2' width='70px'>理论带宽</td><td class='tdValue'><font color='#003399'>"+vSameDk+"</font></td></tr>";
              strXlMass += "<tr style='tr'><td class='td' colspan='2'width='70px'>接入点名称</td><td class='tdValue'><font color='#003399'>"+vSameMc+"</font></td></tr>";
              strXlMass += "<tr style='tr'><td class='td' colspan='2' width='70px'>接入点地址</td><td class='tdValue'><font color='#003399'>"+vSameDz+"</font></td></tr>";
         }
         if(vNsameMc=="")
         {
            vNsameMc = vSameMc;
            vNsameDz = vSameDz;  
         }
         strXlMass += "<tr style='tr'><td class='td' colspan='3'>最近宽带接入点能力</td></tr>";
         strXlMass += "<tr style='tr'><td class='td' colspan='2' width='70px'>理论带宽</td><td class='tdValue'><font color='#003399'>"+vNsameDk+"</font></td></tr>";
         strXlMass += "<tr style='tr'><td class='td'colspan='2' width='70px'>接入点名称</td><td class='tdValue'><font color='#003399'>"+vNsameMc+"</font></td></tr>";
         strXlMass += "<tr style='tr'><td class='td' colspan='2' width='70px'>接入点地址</td><td class='tdValue'><font color='#003399'>"+vNsameDz+"</font></td></tr>";
//     }
//     else
//     {   
//         strXlMass += "<tr style='tr'><td class='td' colspan='3'>最近宽带接入点信息</td></tr>";
//         strXlMass += "<tr style='tr'><td class='td' colspan='2' width='70px'>理论带宽</td><td class='tdValue'><font color='#003399'>"+vNsameDk+"</font></td></tr>";
//         strXlMass += "<trstyle='tr'><td class='td' colspan='2' width='70px'>局向编码</td><td class='tdValue'><font color='#003399'>"+vNsameJxBm+"</font></td></tr>";
//         strXlMass += "<tr style='tr'><td class='td' colspan='2' width='70px'>局向名称</td><td class='tdValue'><font color='#003399'>"+vNsameMc+"</font></td></tr>";
//     }
     strXlMass += "</table>"; 
     var JxXX = document.getElementById("JxXX");
     JxXX.innerHTML =strXlMass;
}
function GetStatus()//区域状态信息
{
    var params = "_method=GetStatus";
    CtnTrans.Ajax("/main.ashx", "post", params,showStatus,null,{loading:true,loadingText:"系统查询中，请稍候..."}); 
               
}
function showStatus()

{
    var XmlVal = getXmlDoc()
    if (XmlVal == null)
    {
        alert("不能创建XML对象")
        return
    }
    var vError = this.req.responseText.split("#|$");
    if(vError.length==2)
    {
       alert(vError[1]);
       if(vError[1]=="页面已过期，请重新登录")
       {
         LoadingAgain();
       }
       ZyqrFrame.btQurey.disabled=false;
       return;
    }
    var XmlVal = CtnXML.getXmlDoc();
    XmlVal.loadXML(ResText);
    var root =  XmlVal.selectNodes('Items');
    var nodes = XmlVal.selectNodes('Items/Item');
    var ZqyOption = document.createElement("OPTION");
    ZqyOption.value = "";
    ZqyOption.text  = "请选择--"; 
    ZyqrFrame.Qyzt.add(ZqyOption);
    if(nodes.length==0)
    {
       return; 
    }
    else
    {  
       for(var i = 0; i < nodes.length; i++)
        {
           var Dbval= nodes[i].selectNodes("dbval");
           var Dispval = nodes[i].selectNodes("dispval");
           var StatusOption = document.createElement("OPTION");
           StatusOption.text=Dispval[0].text;

           StatusOption.value=Dbval[0].text;
           ZyqrFrame.Qyzt.add(StatusOption); 
        }
     }
}
function showTextBox(id)
{    
   if(id=="txtNextAddr")
   {  
      init() ;
      if(ZyqrFrame.Addr2.value=="")
      {
         ZyqrFrame.Addr2.style.display   = "block";
         alert("请先选择第二级...");
         ZyqrFrame.Addr2.focus();
       }
    }
}
function OnkeyDownQuery()
{
  if(event.keyCode==13)
  {
      dzQuery(1, 1);
  }
}
function  SecendEntLocate(resType,resCode,vfgfw,vJzMc,vaddNet,vjxBm, LstRes, LstRescode,strAnzWz,strLAN)
{
    var params = "_method=ShowFxh&&vJxbm="+vjxBm+"&LstRes="+LstRes+"&LstResCode="+LstRescode
    CtnTrans.Ajax("/main.ashx", "post", params,ShowDeteilMassage,{fgfw:vfgfw,Jzmc:vJzMc,vaddNet:vaddNet,vJxbm:vjxBm},{loading:true,loadingText:"系统查询中，请稍候..."}); 
}
function GetEntLocate(resType,resCode)
{
    top.EntityLocatByNo(1,resType,resCode,true);
}
function setCookie(name,value)//两个参数，一个是cookie的名子，一个是值
{
    var expdate = new Date();
    var argv = setCookie.arguments;
    var argc = setCookie.arguments.length;
    var expires = (argc > 2) ? argv[2] : 365 * 24 * 60 * 60;
    var path = (argc > 3) ? argv[3] : null;
    var domain = (argc > 4) ? argv[4] : null;
    var secure = (argc > 5) ? argv[5] : false;
    if(expires!=null) expdate.setTime(expdate.getTime() + ( expires * 1000 ));
    document.cookie = name + "=" + escape (value) +((expires == null) ? "" : ("; expires="+ expdate.toGMTString()))
        +((path == null) ? "" : ("; path=" + path)) +((domain == null) ? "" : ("; domain=" + domain))
        +((secure == true) ? "; secure" : "");
    delete value;
}
function getCookie(name)//取cookies函数        
{
    var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
    if(arr != null)
    {
        return unescape(arr[2]);
    }
return null;
}
function delCookie(name)//删除cookie
{
    var exp = new Date();
    exp.setTime(exp.getTime() - 1);
    var cval=getCookie(name);
    if(cval!=null) document.cookie= name + "="+cval+";expires="+exp.toGMTString();
}

function CheckLan()
{
     if(ZyqrFrame.CheLan.checked==true)
     {
        return 1;
     }
     else
     {
      return 0;
     }
}
function openWnd()
{
}
String.prototype.isCharType = function()
{
    var qureyType = "JP";
    for (var i = 0; i < this.length; i++ )
    {
        if(this.charCodeAt(i)<0||this.charCodeAt(i)> 255)//中文查询
        {
            return qureyType="ZW";
        }
    }
    return qureyType;
}
function ChangeChar(vChar)
{
    vChar = vChar.replace("<", "&lt;").replace(">", "&gt;");
    return vChar;
}
function AutoQuery()//自动查询地址
{
}
function SaveResurce(id)//保存选中的资源
{

}
function ShowResult()
{

}
function SetWindow(url)//设计页面大小
{   
    var vClintHei = screen.height;
    var vClintWid = screen.width;
    window.open(url,"","height='"+vClintWid+"',width='"+vClintWid+"', top=0,left=0  toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,status=no")    
}
function CloseDlg()
{
    CloseWindow(); 
    window.opener="xxx"
    window.close();//存储成功后，自动关闭页面
}
function SetYyqByCrm()
{
    var XmlVal = getXmlDoc()
    if (XmlVal == null)
    {
        alert("不能创建XML对象")
        return
    }
    var vError = this.req.responseText.split("#|$");
    if(vError.length==2)
    {
       alert(vError[1]);
       if(vError[1]=="页面已过期，请重新登录")
       {
          LoadingAgain();
       }
       ZyqrFrame.btQurey.disabled=false;
       return;
    }
    XmlVal.loadXML(this.req.responseText);
    var root =  XmlVal.selectNodes('Items');
    var roots = XmlVal.selectNodes('Items/Item');
    var nodes =SortdataNodes(roots,"dispval");
    var ZqyOption = document.createElement("OPTION");
    ZqyOption.value = "";
    ZqyOption.text  = "请选择--"; 
    ZyqrFrame.SelJux.add(ZqyOption);
    if(nodes.length==0)
    {
       return; 
    }
    else
    {  
       for(var i = 0; i < nodes.length; i++)
        {
           var Dbval= nodes[i].selectNodes("dbval");
           var Dispval = nodes[i].selectNodes("dispval");
           var StatusOption = document.createElement("OPTION");
           StatusOption.text=Dispval[0].text;

           StatusOption.value=Dbval[0].text;
           ZyqrFrame.SelJux.add(StatusOption); 
        }
     }
}
function SortdataNodes(Changedata,colName)
{
     if(Changedata.length)
     {
        var vTmpValue = "<?xml version=\"1.0\" encoding=\"gb2312\" standalone=\"yes\"?><Items>";
       var  XmlVal = null;
       var vFirstMin = "";//最小的值
        for (var i = 0 ;i < Changedata.length; i++)
        {
            var vSecondMin = null;//第二小的值
            for(var j = 0 ;j < Changedata.length; j++)
            {
                if((vSecondMin > Changedata[j].selectNodes(colName)[0].text || vSecondMin==null )&& Changedata[j].selectNodes(colName)[0].text > vFirstMin)
                {
                      vSecondMin = Changedata[j].selectNodes(colName)[0].text;
                      XmlVal = Changedata[j].xml;
                }
            }
            vFirstMin = vSecondMin;
            vTmpValue += XmlVal;
        }
        vTmpValue +="</Items>";
        
        var XmlVal = getXmlDoc()
        if (XmlVal == null)
        {
            alert("不能创建XML对象")
            return
        }
        XmlVal.loadXML(vTmpValue);
        Changedata = XmlVal.selectNodes('Items/Item');
     }
    return Changedata;
}
function GetTelJx(telNum)
{
    var params = "_method=GetUserInfo&Tel="+telNum;  
    CtnTrans.Ajax("/main.ashx", "post", params,ShowTelJx,null,{loading:true,loadingText:"系统查询中，请稍候..."}); 
}
function ShowTelJx(res)
{
    var m="M";
    var ResText = res.responseText;
    if (!CtnError.validate(ResText))
    {
         CtnError.show();
         return;
    }
    var resPonse = ResText.split("#@$");
    var UserAddr = resPonse[0];
    var UserName = resPonse[1];
    var UserTel  = resPonse[2];
    var UserAdsl = resPonse[3];
    if(UserAddr=="" && UserName=="")
    {
       alert("没有找到相关的用户信息...");
    }
    if(UserName.length < 4)
    {
       UserName = "&nbsp";
    }
    var szHtm = "<table width='100%' border='0' cellpadding='0' cellspacing='0' bgcolor='#ECEEEB'><tr><td width='8' valign='bottom'><img src='../Images/main/outable-leftop.jpg'  alt='rightbo6' /></td>";
    szHtm += "<td align='left' valign='middle' style='background-image:url(../Images/main/outable-top.jpg); background-repeat:repeat-x; background-position:bottom;'><table width='120' border='0' cellspacing='0' cellpadding='0'><tr>";
    szHtm += "<td align='left' bgcolor='#ECEEEB' class='text1'><img src='../Images/main/User-exit.gif'  style='z-index:1;'  alt=''/> 用户信息</td>";
    szHtm += "</tr></table></td><td width='8' valign='bottom'><img src='../Images/main/outable-rightop.jpg' width='8' height='16'  alt=''/></td></tr><tr>";
    szHtm += "<td width='8' style='background-image: url(../Images/main/outable-left.jpg); background-repeat:repeat-y;'>&nbsp;</td><td height='100%' width='100%' valign='top'><table  cellpadding='0' cellspacing='0' border='0' width='100%'>";
    if(m_softVersion=="2")
    {
      szHtm += "<tr><td valign='top' width='80'><span class='text1'>用户名称:</span></td><td width='70%'>"+UserName+"</td></tr>";
    }
    szHtm += "<tr><td><span class='text1' valign='top' width='80'>电话号码:</span></td><td width='70%'>"+UserTel+"</td></tr>";
    szHtm +="<tr><td  valign='top' width='80'><span class='text1'>宽带号码:</span></td><td width='70%'>"+UserAdsl+"</td></tr>";
    szHtm +="<tr><td valign='top'><span class='text1'>用户地址:</span></td><td width='70%' >"+UserAddr+"</td></tr>";
    szHtm += "</table></td><td width='8' style='background-image: url(../Images/main/outable-right.jpg); background-repeat:repeat-y;'>&nbsp;</td></tr><tr><td width='8'><img src='../Images/main/outable-leftbo.jpg' width='8' height='8'  alt='rightop77'/></td>";
    szHtm += "<td><img src='../Images/main/outable-bottom.jpg' width='100%' height='8' alt='bottom' /></td><td width='8'><img src='../Images/main/outable-rightbo.jpg' width='8' height='8'  alt='outable8' /></td></tr></table>";
    var UserInfo = document.getElementById("UserInfo")
    UserInfo.innerHTML = szHtm;
    document.getElementById("UserInfo").style.display="block";
    if(CheckLan()=="1")
    {
        var params = "_method=GetLanInfo&vJxbm="+dataNodes[0].selectNodes("jxbm")[0].text.split(',')[0]+"&vFgfw="+dataNodes[0].selectNodes("fgfw")[0].text+"&lanCode="+dataNodes[0].selectNodes("NetResCode")[0].text; 
        CtnTrans.Ajax("/main.ashx", "post", params,shwoDetailLan,null,{loading:true,loadingText:"系统查询中，请稍候..."}); 
    }
    else
    {
         DirShowFxh(vType, ResCodenodeVal, m_vFgfw,reSultjzmc,vaddNet,xmlJxbm[0].text, vLstRes, vLstResCode,strAnzWz,strlansb);
    }
}